
import java.util.*;
import java.util.Scanner;

// 注意类名必须为 Main, 不要有任何 package xxx 信息
public class Main1{
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);

            int n = in.nextInt();
            int k = in.nextInt();
        PriorityQueue<Integer>pq=new PriorityQueue<>();

        for (int i=0;i<n;i++){
            int num=in.nextInt();
            pq.offer(num);
        }

        int times=0,sum=0;

        while (sum<=k){
            int current=pq.poll();
            sum+=current;
            if (sum>k){
                break;
            }

            pq.offer(current*2);
            times++;
        }
        System.out.println(times);
        }

    }
